//配置插件目录
layui.config({
    base: '/lay-excel/provinceLayui/mods/'
    , version: '1.0'
});

var layer;
var form;
var layarea;
layui.use(['layer', 'form', 'layarea'], function () {
    layer = layui.layer;
    form = layui.form;
    layarea = layui.layarea;

    layarea.render({
        elem: '#area-picker',
        change: function (res) {

        }
    });
});


//取消
function cancel() {
    var layer_1=parent.layer_1;
    layer_1.close(layer_1.index);
}

//确定修改地址
function sure() {

    var province=$("#province option:selected").text()
    var city=$("#city option:selected").text();
    var county=$("#county option:selected").text();
    var textarea=$("#textarea").val()
    var receivingAddress=province+" "+city+" "+county+" "+textarea;

    var orderId=localStorage.getItem("orderId");

    if(textarea == "undefined" || textarea == null || textarea == ""){
        layer.msg("详细地址不能为空")
    }else{
        $.post("/SyOperationController/setAddress",{"orderId":orderId,"address":receivingAddress},
            function (data) {
                if(data.code==0){
                    parent.location.reload()
                    var layer_1=parent.layer_1;
                    layer_1.close(layer_1.index);

                    parent.getAddress();
                }else{
                    layer.msg("修改失败");
                }
            }
        );
    }
}